<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <style>
        .box {
            width: 100px;
            height: 100px;
            background-color: pink;
        }
    </style>
</head>
<body>
<div class="box"></div>
<script>

    var div = document.getElementsByTagName("div")[0];

//    div.onclick = function () {
//        alert(1);
//    }
    console.log(div.onclick);

    document.onclick = function (event) {
        console.log(event.target);
    }

</script>
</body>
</html>